package com.tianruan.dc.modules.sys.user.mapper;

import com.github.pagehelper.Page;
import com.tianruan.dc.modules.sys.user.entity.dto.FeedbackDTO;
import com.tianruan.dc.modules.sys.user.entity.dto.FeedbackPageQueryDTO;
import com.tianruan.dc.modules.sys.user.entity.dto.LearnPathDTO;
import com.tianruan.dc.modules.userinfo.result.PageResult;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.mapstruct.Mapper;

@Mapper
public interface LearnPathMapper {

    /**
     * 新增学科学习路线
     * @param learnPathDTO
     */
    @Insert("INSERT INTO t_isp_learn_path (id, subject, content, create_time, create_id) VALUES " +
            "(#{id},#{subject},#{content},#{createTime},#{createId})")
    void save(LearnPathDTO learnPathDTO);

    /**
     * 根据学科名获取id
     * @param subject
     * @return
     */
    @Select("select id from t_isp_learn_path where subject = #{subject}")
    String getIdBySubject(String subject);

    /**
     * 删除学科学习路线
     * @param id
     */
    @Delete("delete from t_isp_learn_path where id = #{id}")
    void deleteSubject(String id);

    /**
     * 查询回显学科学习路线
     * @param learnPathDTO
     * @return
     */
//    @Select("SELECT * FROM t_isp_learn_path WHERE subject LIKE #{subject}")
    Page<LearnPathDTO> selectLearnPath(LearnPathDTO learnPathDTO);

    /**
     * 根据ID查询学习指南
     * @param id
     * @return
     */
    @Select("select * from t_isp_learn_path where id = #{id}")
    LearnPathDTO selectById(String id);

    @Select("select id from t_isp_learn_path where id = #{id}")
    String getIdBySubjectId(String id);
}
